<?php

declare(strict_types=1);

namespace App\Request\config;

use Hyperf\Validation\Request\FormRequest;

class ConfigRequest extends FormRequest
{

    protected array $scenes = [
        'create' => ['name', 'config'],
        'update' => ['id', 'name', 'config'],
        'delete' => ['id'],
    ];
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'id' => 'required',
            'name' => 'required',
            'config' => 'required',
        ];
    }

    public function messages(): array
    {
        return [
            'id.required' => 'id不能为空',
            'name.required' => '配置名称不能为空',
            'config.required' => '配置项不能为空',
        ];
    }
}
